#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int Ackmann(int m, int n)
{
    while (m != 0)
    {
        if (n == 0)
        {
            n = 1;
        }
        else
        {
            n = Ackmann(m, n - 1);
        }
        m--;
    }
    return n + 1;
}
int main()
{
    int n = 0;
    int m = 0;
    scanf("%d %d", &m, &n);
    int ret = Ackmann(n, m);
    printf("%d\n", ret);
    return 0;
}